package ru.rchervot.sanasar.client.model;

import com.google.gwt.user.client.rpc.IsSerializable;


public abstract class ItemObjectAbstract implements ItemObject, IsSerializable {
	private Integer ID;
	private String itemView;
	
	@Override
	public Integer getID() {
		return ID;
	}

	public void setID(Integer id) {
		ID = id;
	}

	public void setItemView(String itemView) {
		this.itemView = itemView;
	}

	@Override
	public String getItemView() {
		return itemView;
	}

	@Override
	public boolean equals(Object o) {
		if (o == null) return false;

		if (! (o instanceof ItemObjectAbstract)) return false;

		ItemObjectAbstract to = (ItemObjectAbstract) o;

		return this.ID.equals(to.ID);
	}

	@Override
	public int hashCode() {
		int result = 17;
		result = 37 * result + 
		(ID == null ? 0 : ID.hashCode());
		return result;
	}
	
	@Override
	public boolean isEmpty() {
		return ID == null || ID == 0;
	}
}